import Vue from 'vue'
import VeeValidate, { Validator } from 'vee-validate'
// import zh_CN from 'vee-validate/dist/locale/zh_CN';

// const dict = {
//   custom: {
//     company: {
//       required: '请输入您的公司名称'
//     },
//     totalmoney: {
//       required: () => '请输入您众筹的金额'
//     },
//     cycle: {
//       required: () => '请输入你的众筹周期（天）'
//     },
//     username: {
//       required: () => '请输入您的姓名'
//     },
//     mobile: {
//       required: () => '请输入你的手机号'
//     }
//   }
// };
const dictionary = {
  zh_CN: {
    messages: {
      required: (field) => "请输入" + field,
      max: (field, length) => field + "不得大于" + length + "位",
      min: (field, length) => field + "不得小于" + length + "位",
      digits:(field, length)=>field+ "必须是长度为" + length + "的数字",
      regex: (field) => "请填写正确的" + field
    },
    attributes: {
      mobile: '手机号码',
      pwd: '密码',
      code:'动态码',
      attrName:'规格名称',
      attrPrice:'价格',
      goodsNum:'库存',
      rebateRatio: '返利比例'
    }
  }
}

/*
 * 默认为 'verrors, 解决与vux表单命名冲突'
 */

const config = {
  // errorBagName: 'verrors'
  fieldsBagName: 'veefields'
}

Validator.localize('zh_CN', dictionary.zh_CN)

Vue.use(VeeValidate, config)
